<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆</title>
    <style type="text/css">
        *{
            margin: 0px;
            padding: 0px;
        }
        html,body{
            width: 100%;
            height: 100%;
            background-color: #59375A;
        }
        .a{
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;

        }
        .text{

            background-color: #F2F2F2;
        }
        .text1{
            display: flex;
            align-items: center;
            height: 100px;
            background-color: #6D4A70;
        }
        .text1 span{
            margin-left: 15px;
            color: white;
            font-size: 30px;
        }
        #denglu,#mima{
            width: 200px;
        }
        .text2{
            margin-top: 50px;
        }
        .user{
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }
        .pwd{
            display: flex;
            justify-content: center;
            align-items: center;
        }
        input{
            display: flex;
            align-items: center;
            justify-content: center;
            width: 280px;
            height: 35px;
            border: 1px solid black;
            border-radius: 5px;
            margin: 5px;
            box-sizing: border-box;
            background:transparent;
            outline: none;
        }
        #u_name{
            background-image: url("img/ren.png");
            background-repeat: no-repeat;
            background-position-y: center;
            padding-left: 20px;
            background-position-x:240px ;
            border-radius: 5px;
        }
        #pwd{
            background-image: url("img/suo.png");
            background-repeat: no-repeat;
            padding-left: 20px;
            background-position-x:240px ;
            background-position-y: center;
        }
        button{
            border: 1px solid black;
            border-radius: 2px;
            background-color: #6D4A70;
            padding-right: 10px;
            padding-left: 10px;
            padding-top: 5px;
            padding-bottom: 5px;
            color: white;
            font-size: 20px;
        }
        .text3{
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 50px;
        }
        .text3 span{
            margin-left: 30px;
            font-size: 20px;
        }
    </style>
</head>
<body>
<div class="a">
<div class="text">
    <div class="text1">
        <span>Login Form</span>
    </div>
    <div class="text2">
        <div class="user">
            <input type="text" name="u_name" id="u_name"
                   placeholder="Username" onblur="checkdenglu()" onfocus="denglufocus()">
            <input type="password" name="pwd" id="pwd"
                   placeholder="password" onblur="checkmima()" onfocus="mimafocus()">
        </div>
    </div>
    <div class="text3">
        <button type="submit">Sign in</button>
        <span>Lost your Password</span>
    </div>
</div>
</div>
<script type="text/javascript">
    var denglu=document.getElementById("denglu");
    var mima=document.getElementById("mima");
    function checkdenglu() {
        var u_name=document.getElementById("u_name").value;
        if (u_name.length!=11){
            denglu.innerHTML="登录名有误";
            return false;
        }
        denglu.innerHTML="登录名格式正确";
        return true;
    }
    function denglufocus() {
        denglu.innerHTML="请输入6-12位数字或字母";
    }
    function checkmima() {
        var u_pwd=document.getElementById("u_pwd").value;
        if (u_pwd.length<6||u_pwd==""){
            mima.innerHTML="密码输入有误";
            return false;
        }
        mima.innerHTML="密码格式正确";
        return  true;
    }
    function mimafocus() {
        mima.innerHTML="请输入6-12位数字或字母";
    }
</script>
</body>
</html>